package com.hctforgreen.greenservice.utils;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;

/**
 * 视频搜索 Util
 * 
 * @author denghb
 * 
 */
public class VideoSearchStoreUtil {

	public static final String NAME_DIVIDER = "/";// 搜索内分割符

	/**
	 * 
	 * 
	 * @param name
	 *            搜索名称 中间以/隔开
	 * 
	 * @param activity
	 */
	public static void save(Context context, String name) {
		SharedPreferences sharedPreferences = context.getSharedPreferences(
				HctConstants.VIDEO_TYPE_SEARCH_FILE_NAME,
				Context.MODE_WORLD_WRITEABLE);
		Editor editor = sharedPreferences.edit();
		editor.putString(HctConstants.VIDEO_TYPE_SEARCH_KEY_VALUE, name);
		editor.commit();
	}

	/**
	 * 搜索历史记录
	 * 
	 * @param activity
	 * @return search History array
	 * 
	 */
	public static String get(Context context) {
		SharedPreferences sharedPreferences = context.getSharedPreferences(
				HctConstants.VIDEO_TYPE_SEARCH_FILE_NAME,
				Context.MODE_WORLD_WRITEABLE);
		return sharedPreferences.getString(
				HctConstants.VIDEO_TYPE_SEARCH_KEY_VALUE, "");
	}

}
